/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package client_multiclient;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Tri
 */
public class Client_MultiClient {

     public static int port = 5000;
    /**
     * @param args the command line arguments
     */   
    public static void main(String[] args) {
        try {
            // TODO code application logic here
            Socket socket = new Socket(InetAddress.getLocalHost(), port);
            System.out.println("Client connected server");
            BufferedReader inFormUse = new BufferedReader(
                    new InputStreamReader(System.in));
            BufferedReader inFormServer = new BufferedReader(
                    new InputStreamReader(socket.getInputStream()));
            DataOutputStream outToServer = new DataOutputStream(
                    new DataOutputStream(socket.getOutputStream()));
            
            String strToServer,strFormServer;
            strToServer = inFormUse.readLine();
            
            outToServer.writeBytes(strToServer+'\n');
            System.out.println("Sent to server : "+strToServer);
            strFormServer = inFormServer.readLine();
            System.out.println("Get form server : "+strFormServer);
                    
        } catch (IOException ex) {
            Logger.getLogger(Client_MultiClient.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
